package com.handu.luna.core.domain.promotion;

import com.handu.luna.core.domain.BasePersistentDomain;
import com.handu.luna.core.domain.user.User;

import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import java.util.Date;

/**
 * 优惠券/红包
 */
@SuppressWarnings("rawtypes")
@MappedSuperclass
public class Bonus extends BasePersistentDomain{

    //优惠券/红包 类型ID
    protected Long bonusPromotionId;
    @Transient
    protected BonusPromotion bonusPromotion;
    //序列号
    protected String code;
    //使用订单编号
    protected String orderId;
    //使用用户ID
    protected Long userId;
    @Transient
    protected User user;
    //使用日期
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected Date usedDate;

    public Bonus(){

    }

    public Bonus(String code, Long userId, String orderId, Date usedDate) {
        this.code = code;
        this.userId = userId;
        this.orderId = orderId;
        this.usedDate = usedDate;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Date getUsedDate() {
        return usedDate;
    }

    public void setUsedDate(Date usedDate) {
        this.usedDate = usedDate;
    }

    public Long getBonusPromotionId() {
        return bonusPromotionId;
    }

    public void setBonusPromotionId(Long bonusPromotionId) {
        this.bonusPromotionId = bonusPromotionId;
    }

    public BonusPromotion getBonusPromotion() {
        return bonusPromotion;
    }

    public void setBonusPromotion(BonusPromotion bonusPromotion) {
        this.bonusPromotion = bonusPromotion;
    }
}
